using GGameFramework.Event;

namespace GGameFramework.Event
{
    public partial class EventManager
    {
        #region TypeEventSystem 接口
        public void Register<T>(IEventListener listener, System.Action<T> onEvent)
        {
            mTypeEventSystem.Register<T>(onEvent);
            // TrackTypeRegistration(typeof(T).Name, listener);
        }

        public void Register<T>(System.Action<T> onEvent)
        {
            mTypeEventSystem.Register(onEvent);
        }

        public void UnRegister<T>(System.Action<T> onEvent)
        {
            mTypeEventSystem.UnRegister(onEvent);
        }
        
        public void Send<T>() where T : new()
        {
            mTypeEventSystem.Send<T>();
        }
        public void Send<T>(T eventData)
        {
            mTypeEventSystem.Send<T>(eventData);
        }
        #endregion
        
        // #region 注册跟踪
        // public void TrackTypeRegistration(string eventName, object listener)
        // {
        //     if (!mTypeListeners.ContainsKey(eventName))
        //         mTypeListeners[eventName] = new System.Collections.Generic.List<object>();
        //
        //     if (!mTypeListeners[eventName].Contains(listener))
        //         mTypeListeners[eventName].Add(listener);
        // }
        // #endregion
    }
}

